<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/

$api = app('Dingo\Api\Routing\Router');



//Auth
$api->version('v1', ['prefix' => 'auth', 'namespace' => 'App\Http\Controllers'], function ($api) {
    //Grant
    $api->post('/grant', ['uses' => 'AuthController@grant']);
});

$api->version('v1', ['prefix' => 'auth', 'namespace' => 'App\Http\Controllers', 'middleware' => 'auth'], function ($api) {

    //Revoke
    $api->get('/revoke', ['uses' => 'AuthController@revoke']);
});


//User
$api->version('v1', ['prefix' => 'user', 'namespace' => 'App\Http\Controllers'], function ($api) {
    //$api->get('/test', ['uses' => 'ExampleController@index']);

    //Register
    $api->any('/register', ['uses' => 'UserController@register']);

    $api->any('/captcha', ['uses' => 'UserController@getCaptcha']);

    $api->any('/send', ['uses' => 'UserController@send']);
});

//Captcha
$api->version('v1', ['prefix' => 'captcha', 'namespace' => 'App\Http\Controllers'], function ($api) {

    //Get
    $api->get('/', ['uses' => 'CaptchaController@getCaptcha']);
});
